package cn.huijielong.modules.pub.service.impl;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;

import cn.huijielong.common.utils.Query;
import cn.huijielong.modules.pub.dao.UserOpenidDao;
import cn.huijielong.modules.pub.entity.UserOpenidEntity;
import cn.huijielong.modules.pub.service.UserOpenidService;
import cn.huijielong.modules.sys.service.impl.SimpleServiceImpl;



@Service("userOpenidService")
public class UserOpenidServiceImpl extends SimpleServiceImpl implements UserOpenidService {
	@Autowired
	private UserOpenidDao userOpenidDao;
	
	@Override
	public UserOpenidEntity queryObject(Long userId){
		return userOpenidDao.queryObject(userId);
	}
	
	@Override
	public Page<UserOpenidEntity> queryList(Query q){
	    Page<UserOpenidEntity> page=PageHelper.startPage(q.getPage(), q.getLimit()).doSelectPage(()-> userOpenidDao.queryList(q));
		return page;		
	}
	
	@Override
	public int queryTotal(Map<String, Object> map){
		return userOpenidDao.queryTotal(map);
	}
	
	@Override
	public void save(UserOpenidEntity userOpenid){
		userOpenidDao.save(userOpenid);
	}
	
	@Override
	public void update(UserOpenidEntity userOpenid){
		userOpenidDao.update(userOpenid);
	}
	
	@Override
	public void delete(Long userId){
		userOpenidDao.delete(userId);
	}
	
	@Override
	public void deleteBatch(Long[] userIds){
		userOpenidDao.deleteBatch(userIds);
	}

	@Override
	public UserOpenidEntity queryByOpenid(String openid) {
		return userOpenidDao.queryByOpenid(openid);
	}
	
}
